package nw;


public class Test {
    public static void main(String[] args) {
        Cat c1 = new Cat();
        c1.setName("huahua");
        System.out.println(c1.getName());
        c1.catchMouse();
    }
}

class Animal {
    protected String name;

    public Animal() {
    }

    public Animal(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void eat() {
        System.out.println("吃");
    }

    public void shout() {
        System.out.println("叫");
    }
}

class Cat extends Animal {
    public Cat() {
    }

    public Cat(String name) {
        super(name);
    }

    public void catchMouse() {
        System.out.println("抓老鼠");
    }
}

class Dog extends Animal {
    public Dog() {
    }

    public Dog(String name) {
        super(name);
    }

    public void lookHouse() {
        System.out.println("看家");
    }
}

